﻿Public Class Bookmarks
    Dim remove As Boolean = False
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        If remove = False Then
            Dim Eintrag() As String = Split(ListBox1.SelectedItem, "|")
            Form1.NewTab("Lade...", Eintrag(Eintrag.Length - 1))
        Else
            Try
                If Not ListBox1.SelectedItem = "" Then
                    If MsgBox("Möchten sie das Lesezeichen ''" & ListBox1.SelectedItem & "'' wirklich löschen", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
                        ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
                        Dim Bookstring As String = ""
                        For i = 0 To ListBox1.Items.Count - 1
                            Bookstring &= Me.ListBox1.Items(i) & "||"
                        Next
                        SaveSetting("glumeX", "Settings", "Bookmarks", Bookstring)
                    End If
                End If
            Catch
            End Try
        End If
    End Sub

    Public Sub Open(ByVal Funktion As String)
        If Funktion.ToLower = "remove" Then
            remove = True
            Show()
        ElseIf Funktion.ToLower = "select" Then
            remove = False
            Show()
        End If
    End Sub
End Class